package com.example.park2212.member

import androidx.lifecycle.MutableLiveData
import com.example.lib_base.entity.MemberBean
import com.example.lib_base.mvvm.BaseViewModel
import com.example.lib_base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class MemberViewModel@Inject constructor(val apiservice: ApiService):BaseViewModel() {

    val getMemberSuccess = MutableLiveData<MemberBean>()

    fun getMember(userId:Int){
        httpRequest2({
            apiservice.getMember(userId)
        },getMemberSuccess::postValue)
    }

    val upgradeMemberSuccess = MutableLiveData<MemberBean>()
    fun upgradeMember(userId:Int,newMembershipLevel:String){
        httpRequest2({
            apiservice.upgradeMember(userId,newMembershipLevel)
        },upgradeMemberSuccess::postValue)
    }
}